package main

import (
	"algorithm/model"
	"fmt"
	"math/rand"
)

func main(){
	//BinarySearch()
	//SelectionSort()
	//FibonacciSequence()
	QuickSort()
}

func BinarySearch(){
	var arr map[int]int
	arr = make(map[int]int)
	for i := 0; i < 1000; i++ {
		arr[i]=i
	}
	fmt.Println("arr:",arr)
	mid, search, num := model.BinarySearch(arr, 66)
	fmt.Println("mid:",mid,"search:",search,"num:",num)
}
func SelectionSort() {
	var arr map[int]int
	arr = make(map[int]int)
	for i := 0; i < 10; i++ {
		arr[i] = rand.Intn(100)
	}
	fmt.Println("arr:", arr)
	result := model.SelectionSort(arr)
	fmt.Println("result:", result)
}
func FibonacciSequence() {
	m, sum := model.FibonacciSequence(5)
	fmt.Println("第n个数：", m, "第n个数的总和：", sum)
}
func QuickSort() {
	params := []int{7, 3, 5, 1, 9, 2, 16, 8, 6, 20, 11, 45, 33, 22, 17, 13, 12, 10, 50, 51, 52, 53, 60, 62, 63, 64, 65, 70, 80, 81, 82, 83, 84, 85}
	model.QuickSort(params)
}
